package com.hd.crdao.activity;

import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.hd.crdao.R;
import com.hd.crdao.base.BaseSecondActivity;
import com.hd.crdao.config.Constants;
import com.hd.crdao.utils.UIUtils;
import com.hd.crdao.view.ExpandHeadView;

import butterknife.BindView;
import butterknife.OnClick;

/**
 *
 *@author Programming
 *@date 2017/5/23 0023
 */
public class AboutUsActivity extends BaseSecondActivity {


    @BindView(R.id.aboutus_head)
    ExpandHeadView mAboutUsHead;
    @BindView(R.id.about_us)
    TextView mAboutUs;
    @BindView(R.id.helps)
    TextView mHelps;
    @BindView(R.id.services_number)
    RelativeLayout mServicesNumber;


    @Override
    protected void initView() {

    }

    @Override
    protected int setContentView() {
        return R.layout.activity_aboutus;
    }

    @Override
    protected ExpandHeadView setExpandHeadView() {
        return mAboutUsHead;
    }

    @OnClick({R.id.about_us, R.id.helps, R.id.services_number})
    public void onViewClicked(View view) {
        switch (view.getId()) {

            case R.id.about_us:
                goWhatActivity(Constants.ABOUTUS_URL);
                break;
            case R.id.helps:
                goWhatActivity(Constants.HELP_URL);
                break;
            case R.id.services_number:
                takePhoneToServices();
                break;
            default:
                break;
        }
    }

    /**
     * 打开某个URL链接
     * @param helpUrl URL链接
     */
    private void goWhatActivity(String helpUrl) {
        Intent help = new Intent(UIUtils.getContext(), LoadUrlAboutUsActivity.class);
        help.putExtra("url", helpUrl);
        startActivity(help);
    }

    /**
     * 拨打客服电话
     */
    private void takePhoneToServices() {
        String phoneNumber = UIUtils.getResources().getString(R.string.companyTelephone);
        Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNumber));
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
    }

}
